package com.ld.control.utils;

import com.ld.control.business.process.vo.internal.HomeShelfPointInfo;
import com.ld.control.business.process.vo.internal.RecoveryShelfPointInfo;
import com.ld.control.business.process.vo.internal.EquipmentRotateAParamrray;
import com.ld.control.business.variable.model.VariableExampleModel;
import com.ld.control.business.variable.model.VariableModel;
import com.ld.control.business.variable.service.VariableExampleService;
import com.ld.control.business.variable.service.VariableService;
import com.ld.control.exception.BusinessException;
import com.ld.control.sysenum.SystemVariableEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;

import java.util.List;

@Component
public class VariableExampleUtils {

    @Autowired
    private VariableExampleService variableExampleService;

    @Autowired
    private VariableService variableService;

    public void exist(String value) {
        if (value.startsWith("@")) {
            // 查询变量是否存在
            String newValue = value.substring(1);
            VariableModel variableModel = variableService.getByName(newValue);
            if (ObjectUtils.isEmpty(variableModel)) {
                throw new BusinessException(value + "变量不存在!");
            }
        }
    }

}
